

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:gczn_hd/app/core/base/handle_mixin.dart';
import 'package:gczn_hd/app/core/values/App_img.dart';
import 'package:gczn_hd/app/core/values/app_colors.dart';
import 'package:gczn_hd/app/core/values/app_values.dart';
import 'package:gczn_hd/app/core/values/text_styles.dart';
import 'package:get/get.dart';

class BottomMenu extends StatelessWidget with HandleMixin{


  final List<Map<String, String>> menu = [
    {"icon": AppImg.stopEntry, "name": "停机录入"},
    {"icon": AppImg.processStudy, "name": "工艺分析"},
    {"icon": AppImg.spotInspection, "name": "设备点检"},
    {"icon": AppImg.equipmentHealth, "name": "设备健康"},
    {"icon": AppImg.equipmentMaintenance, "name": "设备维修"},
    {"icon": AppImg.machineSignage, "name": "机器看板"},
    {"icon": AppImg.operationMachine, "name": "设备运维"},
  ];

  @override
  Widget build(BuildContext context) {

    return Container(
      alignment: Alignment.topLeft,
      padding: EdgeInsets.only( top: AppValues.size66.h),  
      height: AppValues.size311.h,
      decoration: const BoxDecoration(
        image: DecorationImage(
          image: AssetImage(AppImg.menuBg),
          fit: BoxFit.fill, 
          alignment: Alignment.topLeft,
        ), 
      ),
      child: ListView(
        scrollDirection: Axis.horizontal,
        children: [
          for (var entry in menu.asMap().entries)
            GestureDetector(
              onTap: (){
                showAlert(content: entry.value["name"]!);
              },
              child: Container(
              margin: EdgeInsets.only(left: AppValues.size65.w,right: AppValues.size57.w),
              child: Column(
                children: [
                  Image.asset(entry.value["icon"]!, width: AppValues.size108.w, height: AppValues.size108.h),
                  SizedBox(height: 8.h),
                  Text(
                    entry.value["name"]!,
                    style: TextStyle(
                        color: AppColors.colorWhite,
                        fontSize: AppValues.margin_30.sp
                    ),
                  ),
                ],
              ),
            ),
            )
        ],
      )
    );
  }
} 

